package com.rover022.flixelgame.ui.battle
{
	import com.bit101.components.Window;
	import com.rover022.flixelgame.manager.AssetManager;
	import com.rover022.flixelgame.manager.PlayerManager;
	import com.rover022.flixelgame.manager.WorldManager;
	import com.rover022.flixelgame.ui.BaseUI;
	import com.rover022.flixelgame.utils.MiniComponentTool;
	import com.rover022.flixelgame.vo.UserVo;
	import com.rover022.flixelgame.world.BattleState;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	/**
	 * 选择战场
	 * @author flashpig
	 *
	 */
	public class ChoiceBattlePop extends BaseUI
	{
		private var backGround:Sprite;
		private var curPage:uint = 0;
		private var topPage:uint = 0;
		private var pageCount:uint = 4;
		private var selectBattle:*;
		
		public var swfId:String = "ui/MainUI.swf";
		public var classId:String = "ui/MainUI.swf";
		
		public function ChoiceBattlePop()
		{
			var ui:Window = MiniComponentTool.getPopWindow("ChoiceBattlePop", close);
			addChild(ui);
			
			//assetUI = AssetManager.getInstance().requestAssetInstance(swfId, classId);
			//assetUI.closeButton.addEventListener(MouseEvent.CLICK,close);
		}

		/**
		 * 加载战场配置文件来初始化UI
		 * @param src
		 *
		 */
		public function loaderBattleXML(src:String):void
		{
			
		}
		
 
		/**
		 * 进入那种战场
		 * @param e
		 *
		 */
		public function gotoBattle(e:MouseEvent):void
		{
			var _battlestate:BattleState = new BattleState();
			_battlestate.initData();
			WorldManager.getInstance().gotoWorld(WorldManager.BATTLE, _battlestate);
		}

		/**
		 * 下一个战场 场景
		 * @param e
		 *
		 */
		public function nextBattle(e:MouseEvent = null):void
		{
			if (curPage < topPage)
			{
				curPage += pageCount;
				showBattle(curPage);
			}
		}

		/**
		 * 前一个战场 场景
		 * @param e
		 *
		 */
		public function perBattle(e:MouseEvent = null):void
		{
			if (curPage > 0)
			{
				curPage -= pageCount;
				showBattle(curPage);
			}
		}

		/**
		 * 显示战场数据
		 * @param _num
		 *
		 */
		public function showBattle(_num:uint):void
		{
			
		}
		
		 
		
		
	}
}
